import { Button } from "antd";

export function userTableColumns(editAction: any, deleteAction: any) {
    return [
      {
        title: "用户ID",
        hidden: true,
        dataIndex: "user_id",
        key: "user_id",
      },
      {
        title: "用户名",
        dataIndex: "user_name",
        key: "user_name",
      },
      {
        title: "机构名称",
        dataIndex: "dept_name",
        key: "dept_name",
      },
      {
        title: "昵称",
        dataIndex: "nick_name",
        key: "nick_name",
      },
      {
        title: "性别",
        dataIndex: "sex",
        key: "sex",
        render: (sex: string) => {
          return sex === "0" ? "男" : "女";
        },
      },
      {
        title: "状态",
        dataIndex: "status",
        key: "status",
        render: (status: string) => {
          return status === "0" ? "正常" : "停用";
        },
      },
      {
        title: "录入时间",
        dataIndex: "create_time",
        key: "create_time",
      },
      {
        title: "执行",
        dataIndex: "state",
        key: "state",
        render: (state: number, record: any) => (
          <div>
            <Button type="primary" color="default" onClick={() => editAction("edit", record)}>
              编辑
            </Button>
            <Button className="ml-2" danger type="primary" onClick={() => deleteAction(record)}>
              删除
            </Button>
          </div>
        ),
      },
    ];
  }